<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        textarea{height:400px;}
    </style>
</head>
<body>
    <textarea id="txt1"></textarea>
    <input type="button" id="btn" value="转换">
    <textarea id="txt2"></textarea>
</body>
<script>

    var otxt1 = document.querySelector("#txt1")
    var otxt2 = document.querySelector("#txt2")
    var obtn = document.querySelector("#btn")

    // 正则的贪婪特性：尽可能的多匹配
    // 慎用通配符

    obtn.onclick = function(){
        // html标签的替换的正则
        var reg = /<[^>]+>/g;

        otxt2.value = otxt1.value.replace(reg, "");
    }
    
</script>
</html>